{% extends 'activity/activity-layout.html.twig' %}
{% do script(['libs/ltc-sdk-client.js', cloud_sdk_url('uploader'), 'libs/perfect-scrollbar.js', 'videoactivity/js/create/index.js']) %}
{% set length = activity.length|default(0)|convert_minute_and_second %}
{% block activity_step %}
  <div class="tab-pane js-course-tasks-pane active js-step2-view">
    <form class="form-horizontal" id="step2-form" data-media-id="{{ activity.mediaId|default(null) }}">
      <div class="form-group">
        <div class="col-sm-2 control-label">
          <label for="title" class="control-label-required">{{ 'course.plan_task.activity_manage.title_name'|trans }}</label>
        </div>
        <div class="col-sm-10">
          <input id="title" class="form-control" type="text" name="title" value="{{ activity.title|default('') }}" >
          <div class="help-block">{{ 'course.plan_task.activity_manage.help_block'|trans }}</div>
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-2 control-label">
          <label for="media" class="style control-label-required">{{ 'course.plan_task.activity_manage.video'|trans }}</label>
        </div>
        <div class="col-sm-10">
          {% if activity.ext.mediaSource|default(null) and activity.ext.mediaSource != 'self' %}
            {% set selectedFile = {'status': 'none', 'source': activity.ext.mediaSource, 'uri': activity.ext.mediaUri } %}
          {% endif %}
          {% include 'file-chooser/file-choose.html.twig' with {mediaType: 'video','courseId': activity.fromCourseId, fileType:'video', file: activity.ext.file|default(null), link: activity.ext.mediaSource|default(null), selectedFile: selectedFile|default(null) } %}
        </div>
      </div>
      <div class="form-group for-video-type" id="lesson-length-form-group">
        <div class="col-sm-2 control-label for-video-type">
          <label class="control-label-required">{{ 'course.plan_task.activity_manage.video.time'|trans }}</label>
        </div>
        <div class="col-sm-10">
          <!-- todo:mediaId 和 ext_mediaId的字段整改 -->
          <input class="form-control width-150 js-length" id="minute" type="text" name="minute"
                 value="{{ length.minute|default(null) }}"><span class="mhs">{{ 'site.date.minute'|trans }}</span><input
            class="form-control width-150 js-length" id="second" type="text" name="second"
            value="{{ length.second|default(null) }}">{{ 'site.date.second'|trans }}
          <input type="hidden" id="length" name="length" value="{{ activity.length|default(0) }}">
        </div>
      </div>

      {% if setting('storage.upload_mode', 'local') == 'cloud' and activity.ext.mediaSource|default('self') == 'self' %}
        <div class="form-group for-video-subtitle" id="video-subtitle-form-group">
          <div class="col-sm-2 control-label for-video-subtitle">
            <label class="control-label">{{ 'course.plan_task.activity_manage.video.subtitle'|trans }}</label>
          </div>

          <div class="col-sm-10 controls js-subtitle-list" data-dialog-url="{{ path('media_subtitle_manage_dialog') }}">
            <p style="margin-top:6px;color:#a1a1a1">{{'course.plan_task.activity_manage.video.add_subtitle_tips'|trans}}</p>
          </div>
          <div class="col-sm-offset-2 help-block">
            <p style="margin-left:10px;">
              {{'course.plan_task.activity_manage.video.code_convert_tips'|trans|raw}}
            </p>
          </div>

          <input id="ext_mediaId_for_subtitle" class="form-control" type="hidden" value={{ activity.ext.mediaId|default(null) }}>
        </div>
      {% endif %}
    </form>
  </div>
{% endblock %}